{% extends "base.html" %}
{% block title %}借阅卡详情{% endblock %}
{% block content %}
<h2>欢迎{{current_user.username}}来到图书管理系统，您的角色为{{get_current_role()}}</h2>
<table style="width:100%;border:1px">
    <tr>
        <td>系统编号</td>
        <td>借阅证号</td>
        <td>有效期</td>
        <td>借阅上限</td>
        <td>持有人姓名</td>
        <td>申领状态</td>
        <td>创建时间</td>
        <td>操作</td>
    </tr>
    {% for _, user, borrow_card in borrow_card_list %}
    <tr>
        <td>{{ loop.index }}</td>
        <td>{{ borrow_card.card_id }}</td>
        <td>{{ borrow_card.valid_until }}</td>
        <td>{{ borrow_card.borrow_limit }}</td>
        <td>{{ user.username }}</td>
        <td>{{ user.borrow_card_apply_status | borrow_card_apply_status_filter }}</td>
        <td>{{ borrow_card.create_time }}</td>
        <td>
            {% if user.borrow_card_apply_status == BorrowCardApplyStatus.APPLYING.value %}
                <a href="{{ url_for('card_manage.card_approval', user_id=user.id)}}">去审核</a>
            {% elif user.borrow_card_apply_status == BorrowCardApplyStatus.APPLIED.value %}
                已审核
            {% elif user.borrow_card_apply_status == BorrowCardApplyStatus.UNAPPLY.value %}
                待申请
            {% endif %}
        </td>
    </tr>
    {% endfor %}
</table>
<p>当前一共有{{borrow_card_list|length}}位用户借阅证数据</p>

{% endblock %}